<template>
  <div>
    <!-- 标题 -->
    <van-nav-bar :title="$route.name" left-arrow @click-left="$router.back()"/>
    <div>
      <img class="img" :src="info.img" alt>
    </div>
    <div>
      <p class="p1">优惠券：{{info.title}}</p>
      <p class="p2">价格：￥{{info.price}}</p>
    </div>
  </div>
</template>

<script>
import { getSeckill } from "../request/api";
export default {
  data() {
    return {
      info: {}
    };
  },
  mounted() {
    //组件一加载就调用秒杀
    getSeckill().then(res => {
      console.log(res);
      if (res.code == 200) {
        this.info = res.list[0];
      }
    });
  }
};
</script>

<style scoped>
* {
  margin: 0;
  padding: 0;
}
.van-nav-bar {
  background: #ff6040;
  height: 50px;
  color: #fff;
}
.img {
  width: 100%;
}
.p1 {
  font-size: 20px;
  color: lightcoral;
  margin-left: 5px;
  margin-top: 5px;
}
.p2 {
  font-size: 16px;
  color: lightcoral;
  margin-left: 5px;
}
</style>
